Skip to content

docs(js): Add New Spans guide#17834

Open
inventarSarah wants to merge 29 commits into
masterfrom
smi/span-first/js
Open

docs(js): Add New Spans guide#17834
inventarSarah wants to merge 29 commits into
masterfrom
smi/span-first/js

Conversation

@inventarSarah
Copy link
Copy Markdown
Collaborator

@inventarSarah inventarSarah commented May 21, 2026

DESCRIBE YOUR PR

Adds a new page documenting stream mode for all JS SDKs, covering:

  • How to enable stream mode
  • Migration path from transaction mode
  • Manual instrumentation (start a span, add attributes)
  • Distributed tracing
  • Extended configuration (beforeSendSpan, ignoreSpans)
  • Verify setup

Based on this draft: #17621
Michi's draft includes sections on distributed tracing, which I removed in this version. The APIs work identically in both modes; the topics are advanced enough that users are better served by the existing page, where all the details live, and users who already have distributed tracing set up don't need to change anything when switching to stream mode. Happy to discuss if you disagree.

Questions/Considerations for you

  • Filter Spans and Drop Spans currently use a single snippet per environment (browser/server) rather than framework-specific snippet file -> is that sufficient or should we create framework-specific snippet files, instead?
  • Does the reasoning for removing the Distributed Tracing sections make sense to you? (see explanation above)
  • please leave a comment when the guide uses a wrong (or not the ideal) span name (eg root span vs service span, service span vs child span, ...)

Closes: #17835

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline: end of May
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

EXTRA RESOURCES

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview, Comment May 28, 2026 1:53pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Preview May 28, 2026 1:53pm

Request Review

Comment thread platform-includes/performance/enable-stream-mode/javascript.remix.mdx Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b8d6819. Configure here.

Comment thread platform-includes/performance/enable-stream-mode/javascript.effect.mdx Outdated
Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx Outdated
Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx
Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx Outdated

<PlatformSection notSupported={["javascript.nextjs", "javascript.nuxt", "javascript.sveltekit", "javascript.astro", "javascript.solidstart", "javascript.capacitor", "javascript.tanstackstart-react", "javascript.remix", "javascript.react-router"]}>

- **Check the Sentry dashboard**: Spans should appear in the Traces view shortly after they complete. Traces look the same as in transaction mode, but without transactions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traces look the same as in transaction mode, but without transactions

This is true but unless I missed something, there are very few visual indications that actually point out that a span is a (new) span and not a transaction 😬 The only thing that comes to mind is that it's not showing a JSON button anymore. I don't think there's harm in leaving in this sentence but users might get confused at what they should be looking in the product.

This is of course not a primary docs issue but rather a product/UI issue. We might want to think about some kind of indicator (and, separate topic, please bring back JSON for streamed spans lol). That is assuming, I didn't miss any obvious indication 😅 Will ask product folks about this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I will update this to something like
"Traces look almost the same as in transaction mode. The main difference is that they have no transactions and only consist of spans."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new experience, what do we call those attributes that we currently call transaction?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lms24 Have you received a response from the product team yet?

Copy link
Copy Markdown
Member

@Lms24 Lms24 May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No response so far :( I suggest for now we go with the more generic sentence. If we decide to mark them specifically in the product, we can update this section. (I'm hacking on a small visual indication but no guarantees that this will get approved/merged).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened getsentry/sentry#116386 which proposes a visual indication. Can't promise that this gets merged though yet. Will keep you posted!

@@ -0,0 +1,370 @@
---
title: New Spans
description: "Learn how to use stream mode to send spans to Sentry as they finish, removing the 1,000-span limit and making trace data visible sooner."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cleptric - should we be calling out the 1k span limit as a benefit? Seems really valuable, but want to make sure we're not locking ourselves into something unnecessarily.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't wanna answer for Michi (so feel free to overrule me) but removing the hard 1k limit is the key feature of span streaming. I think we can/should call it out. The 1k limit exists but isn't documented publicly a lot (besides this zendesk page). I don't think it's a secret though, so no harm in mentioning it.

- javascript.cordova
---

<AvailableSince version="10.53.1" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is SDK version? Would be good to clarify.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, let me remove that because we have the required SDK version in the Prerequisites section.


## Extended Configuration (Optional)

### Filter Spans
Copy link
Copy Markdown
Contributor

@sfanahata sfanahata May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be the right place for it, but somewhere on this page I believe we should mention with a slight bit more detail in the description that you also need to modify span.op to span.attributes?.["sentry.op"] and that description becomes name in this new paradigm.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this section to mention these changes in the text accompanying the code snippet. And then I referred to the "migration" note, where I've added the table with all name changes.
wdyt?


</Alert>

### Drop Spans
Copy link
Copy Markdown
Contributor

@sfanahata sfanahata May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lms24 - just wanting to verify that this behavior is true:

In transaction mode, ignoreSpans is evaluated at transaction end (so all attributes accumulated during the span's lifetime are available). In stream mode, it's evaluated at span start (so only initial attributes are considered).

If so, @inventarSarah, it may be useful to add that detail or heads up here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you can find this down below at line 339+
It will render below the split layout section here because the info isn't relevant to the code snippet.
But let me know if you think it would make more sense, or help users avoid missing this info, if we pull it into the split layout.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the stream mode-specific explanation under the section header and left the stream mode vs transaction mode explanations in the migration callout below - wdyt?

Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx Outdated
Co-authored-by: Shannon Anahata <shannon.anahata@gmail.com>
Copy link
Copy Markdown
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass: Just had some minor remarks, other than that this looks good to me!

Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx Outdated
Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx Outdated
Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx Outdated
Comment thread docs/platforms/javascript/common/tracing/new-spans/index.mdx
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
Copy link
Copy Markdown
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document stream mode in JS SDKs

4 participants